package com.shop.user.utils;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.modular.result.PageParams;
import com.modular.result.PageResult;

public class PageUtils {

    public static  <T> PageResult<T> cover(PageParams params){
        PageResult<T> pageResult = new PageResult<>();
        pageResult.setPageSize(pageResult.getPageSize());
        pageResult.setPageNum(pageResult.getPageNum());
        return pageResult;
    }

    public static  <T> PageResult<T> cover(Page<T> page){
        PageResult<T> pageResult = new PageResult<>();
        pageResult.setPageSize(page.getSize());
        pageResult.setPageNum(page.getCurrent());
        pageResult.setData(page.getRecords());
        pageResult.setTotal(page.getTotal());
        pageResult.setTotalPage(page.getPages());
        return pageResult;
    }
}
